/*
When we execute the following code, we find that it displays the same number
twice, even though the two users have different IDs in the password file. Why is this?
   printf("%ld %ld\n", (long) (getpwnam("avr")->pw_uid),
   (long) (getpwnam("tsr")->pw_uid));
 */

/*
avr:x:1001:100:Anthony Robins:/home/avr:/bin/bash
*/

#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>

int
main(void)
{
  struct passwd *passwd = getpwnam("daniel");
  struct passwd *passwd_2 = getpwnam("nx");
  printf("%ld %ld\n", passwd->pw_uid, passwd_2->pw_uid);
  /* ans.
     The return value may point to a static area, and may be overwritten by subsequent calls to 
     getpwent(3), getpwnam(), or getpwuid().  (Do not pass the returned pointer to free(3).)
  */
  return EXIT_SUCCESS;
}
